/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package ga_checkpoint_4;

/**
 *  This is a singleton class that generates unique IDs to be used by Entities.
 * @author Asif Dipon, Harshal Joshi
 */
public class UIDGen {


    private static UIDGen theInstance = null;
    private static int counter = 0;

    /**
     * The private constructor.
     */
    private UIDGen(){}

    /**
     * Get the singleton instance of the class.
     * @return
     */
    public static UIDGen getInstance(){
        if (theInstance==null) theInstance = new UIDGen();
        return theInstance;
    }

    /**
     * Get the next available unique identifier
     * @return
     */
    public int getNextUID(){
        counter++;
        return counter;
    }
}
